<?php
/**
 * Description of database
 *
 * @author dev
 */
class database {
    
    private $link;
    private $user;
    private $host;
    private $pass;
    private $dbname;

    public function __construct(){
        $this->host = DBHOST;
        $this->user = DBUSER;
        $this->pass = DBPASS;
        $this->dbname = DBNAME;
    }
    
    public function ConnectDatabase() {
        $this->link = @mysql_connect($this->host, 
                                     $this->user, 
                                     $this->pass, TRUE) 
                or DIE (mysql_error());
        @mysql_select_db($this->dbname, $this->link) or DIE(mysql_error());
    }
    
    public function PConnectDatabase() {
        $this->link = @mysql_pconnect($this->host,
                                      $this->user, 
                                      $this->pass, TRUE) 
                or DIE (mysql_error());
        @mysql_select_db($this->dbname, $this->link) or DIE(mysql_error());
    }
    
    public function QueryAll ($string) {
        mysql_query('SET NAMES UTF8');
        $result = mysql_query($string);
        return $result;
        mysql_free_result($result);
    }
}

?>